package com.lemon.boot.controller;

import com.lemon.boot.common.base.BaseController;
import com.lemon.boot.common.utils.JwtUtil;
import com.lemon.boot.dto.DeptDTO;
import com.lemon.boot.po.DeptPO;
import com.lemon.boot.service.IDeptService;
import com.lemon.boot.vo.TreeSelectVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 部门表控制层
 *
 * @author Lemon
 * @since 2024-02-29
 */
@Log4j2
@Api(tags = "部门管理")
@RestController
@RequestMapping("dept")
public class DeptController extends BaseController<DeptPO, DeptDTO, IDeptService> {
    /**
     * 获取树形选择数据-包括父部门
     *
     * @return
     */
    @ApiOperation(value = "获取树形选择数据-包括父部门")
    @GetMapping("getParentByTreeSelect")
    public List<TreeSelectVO> getParentByTreeSelect() {
        return super.service.getParentByTreeSelect();
    }

    /**
     * 获取树形选择数据
     *
     * @return
     */
    @ApiOperation(value = "获取树形选择数据")
    @GetMapping("getByTreeSelectByTenantId")
    public List<TreeSelectVO> getByTreeSelectByTenantId() {
        return super.service.getByTreeSelectByTenantId(JwtUtil.getCurrentUser().getTenantId());
    }
}